<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 100px;height: 100px;
            border-radius: 100%;
            background-color: red;
            position: absolute;
        }
    </style>
</head>
<body>

    <div class="box"></div>
    <script>

        let box = document.querySelector(".box")

       
        let timer = null;
        // 100px + 1
        // offsetLeft 100
        function move(){
            box.style.left = box.offsetLeft + 1 + 'px';
            timer =  requestAnimationFrame(move)

            if(box.offsetLeft >= 200){
                cancelAnimationFrame(timer)
            }
        }

        timer =  requestAnimationFrame(move)


    </script>
</body>
</html>